import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UpkeepInfoForm, UpkeepInfoQuery, UpkeepInfoVO } from '@/api/iot/upkeepInfo/types';

/**
 * 查询电梯保养信息列表
 * @param query
 * @returns {*}
 */

export const listUpkeepInfo = (query?: UpkeepInfoQuery): AxiosPromise<UpkeepInfoVO[]> => {
  return request({
    url: '/iot/upkeepInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电梯保养信息详细
 * @param upkeepId
 */
export const getUpkeepInfo = (upkeepId: string | number): AxiosPromise<UpkeepInfoVO> => {
  return request({
    url: '/iot/upkeepInfo/' + upkeepId,
    method: 'get'
  });
};

/**
 * 新增电梯保养信息
 * @param data
 */
export const addUpkeepInfo = (data: UpkeepInfoForm) => {
  return request({
    url: '/iot/upkeepInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改电梯保养信息
 * @param data
 */
export const updateUpkeepInfo = (data: UpkeepInfoForm) => {
  return request({
    url: '/iot/upkeepInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除电梯保养信息
 * @param upkeepId
 */
export const delUpkeepInfo = (upkeepId: string | number | Array<string | number>) => {
  return request({
    url: '/iot/upkeepInfo/' + upkeepId,
    method: 'delete'
  });
};
